/******************************************************************
MIT License http://www.opensource.org/licenses/mit-license.php
Author Mora <qiuzhongleiabc@126.com> (https://github.com/qiu8310)
*******************************************************************/

import { appify, wxp, MyApp, MyStore } from 'base/'

@appify(new MyStore(), { pages: require('./app.cjson?pages'), tabBarList: require('./app.cjson?tabBar.list') })
export default class extends MyApp {
  async onLaunch() {
    // 用户登录
    this.userLogin()

    // 获取设备信息
    const systemInfo = wxp.getStorageSync('systemInfo') || null
    if (!systemInfo) {
      wxp.setStorageSync('systemInfo', wxp.getSystemInfoSync())
    }

    // 获取店铺设置
    this.getSetting()
  }

  async getSetting() {
    const { data } = await this.fetch({ api: 'configs_by_group/system' })
    this.store.systemSetting = data
  }
}

